package com.qf.j2105.controller;

import com.qf.j2105.po.Good;
import com.qf.j2105.service.GoodService;
import com.qf.j2105.vo.GoodVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class GoodController {
    @Autowired
    private GoodService goodService;

    @RequestMapping("/findall")
    @ResponseBody
    //查询所有车辆信息（首页）
    public List<GoodVO> findGood() {

        List<GoodVO> goods = goodService.findGoods();

        return goods;
    }

    //车辆的模糊查询
    @RequestMapping("/likeName")
    @ResponseBody
    public List<Good> likeGoods(String name) {

        List<Good> goods = goodService.likeGoos(name);
        if (goods != null) {
            return goods;
        } else {
            return null;
        }
    }

}
